/**
 * © copyright 2007 geolabs
 * Special class only for geostat use
 *
 */

Document=Controler.extend();

Document.define({
  displayStatus: function(){
      document.getElementById("doc_viewer").style.display='none';
      document.getElementById("doc_log").style.display='block';
      //now=new Date();
      //(depuis "+(now.getSeconds()-this.timeStamp.getSeconds())+" secondes) 
      document.getElementById("doc_log").innerHTML="Génération du document en cours ...";
    },
  newData: function(){
      document.getElementById("doc_log").style.display='none';
      document.getElementById("doc_viewer").style.display='block';
      var tmp=new XmlToJson({xml:this.request.responseXML, root: "result", loop: "item"});
      tmp.createTree();

      var toto=document.getElementById("fichier");	
      if(tmp.tree.result.document){
	toto.href=tmp.tree.result.document;
	document.getElementById('fichier_ext').src="./images/"+tmp.tree.result.document_ext+".png";
	toto.parentNode.style.display='block';
      }
      else{
	toto.parentNode.style.display='none';
      }
      this.request=null;
    }
  });
